package com.topView2;

/**
 * @Author: huangzhigao
 * @Date: 2023/2/12 16:17
 */
public class leecode55 {
    public boolean canJump(int[] nums) {
        int n = nums.length;
        int max = 0;

        for (int i = 0; i < n; i++) {
            if (i > max) {
                //跳不到
                return false;
            }
            max = Math.max(max, i + nums[i]);
        }
        return true;
    }
}
